package com.chenju.javastatic.controller;

import com.chenju.javastatic.common.response.ResponseEntity;
import com.chenju.javastatic.service.EasyTestService;
import com.chenju.javastatic.service.Neo4JService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping(value = "/asm")
public class EasyTestController {
    @Autowired
    private EasyTestService easyTestService;
    @Autowired
    private Neo4JService neo4JService;

    @PostMapping(value = "/parse")
    public ResponseEntity parse(){
        try {
            easyTestService.parseProject();
            neo4JService.batchInsert();
            return ResponseEntity.success("操作成功");
        } catch (Exception e) {
            return ResponseEntity.fail(e.getMessage());
        }
    }
}
